<include file="public:header" />

<div class="container">
  <h4 class="webview-title">物料</h4> 
  <form id="formBox" role="form" action="__ROOT__/index.php?g=api&m=promotion&a=materialsSave" method="post">
	  <input name="pid" type="hidden" value="{:I('pid')}" />
    <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">项目:</label>
          <div class="controls">
            <input name="materialsProject" placeholder="" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div>

    <div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">工艺说明:</label>
          <div class="controls">
            <input name="materialsTech" placeholder="" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">纸张:</label>
          <div class="controls">
            <input name="materialsPlpe" placeholder="" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">规格:</label>
          <div class="controls">
            <input name="materialsGg" placeholder="" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">单件数量:</label>
          <div class="controls">
            <input name="materialsSignNum" placeholder="0" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">单价(件):</label>
          <div class="controls">
            <input name="materialsSign" placeholder="0" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">总价(元):</label>
          <div class="controls">
            <input name="materialsCountMoney" placeholder="0" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">使用数量:</label>
          <div class="controls">
            <input  name="materialsUseNum" placeholder="0" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">

          <!-- Text input-->
          <label class="control-label" for="input01">使用总价(元):</label>
          <div class="controls">
            <input name="materialsUsePrice" placeholder="0" class="form-control" type="text">
            <p class="help-block"></p>
          </div>
        </div><div class="control-group">
          <label class="control-label"></label>
<div class="msg alert"></div>
          <!-- Button -->
          <div class="controls">
            <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
          </div>
        </div>
		</form>
		<p>&nbsp;</p>
</div>

<script type="text/javascript">
$(document).ready(function(){
    //绑定一个指定的表单
    $('#formBox').ajaxForm({ 
		//设置传输的数据类型
		dataType:  'json', 
		//请求成功后，调用的回调函数
		success:  back
    }); 

	$('.msg').hide();

	$("#formBox button").click(function(){
		$('#formBox .msg').hide();
		$('#formBox .msg').removeClass("alert-success");
		$('#formBox .msg').removeClass("alert-danger");
	});
	
    function back(data){
		$('.msg').focus();
        if(data.status === 200){
			location.href="__ROOT__/index.php?g=api&m=promotion&a=detail&id={:I('pid')}";
        }else{
			$('#formBox'+data.Form+'.msg').addClass("alert-danger");
			$('#formBox'+data.Form+'.msg').html(data.msg);
			$('#formBox .msg').show();
        }
    }
});

</script>

<include file="public:footer" />